<!--_meta 作为公共模版分离出去-->
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<link rel="Bookmark" href="favicon.ico" >
<link rel="Shortcut Icon" href="favicon.ico" />
<link rel="stylesheet" type="text/css" href="static/h-ui/css/H-ui.min.css" />
<link rel="stylesheet" type="text/css" href="static/h-ui.admin/css/H-ui.admin.css" />
<link rel="stylesheet" type="text/css" href="lib/Hui-iconfont/1.0.8/iconfont.css" />
<link rel="stylesheet" type="text/css" href="static/h-ui.admin/skin/default/skin.css" id="skin" />
<link rel="stylesheet" type="text/css" href="static/h-ui.admin/css/style.css" />
<link rel="stylesheet" href="node_modules/element-ui/lib/theme-chalk/index.css">    
<link rel="stylesheet" type="text/css" href="css/class_other.css">

<link rel="stylesheet" type="text/css" href="css/personalCenter.css">
<title>闲鱼mini</title>

</head>
<body>
<!--_header 作为公共模版分离出去-->

<header class="navbar-wrapper">
	<div class="navbar navbar-fixed-top">
		<div class="container-fluid cl"> <a class="logo navbar-logo f-l mr-10 hidden-xs" href="/aboutHui.shtml">闲鱼mini</a> <a class="logo navbar-logo-m f-l mr-10 visible-xs" href="/aboutHui.shtml">H-ui</a> <a aria-hidden="false" class="nav-toggle Hui-iconfont visible-xs" href="javascript:;">&#xe667;</a>
			
			<nav id="Hui-userbar" class="nav navbar-nav navbar-userbar hidden-xs">
				<ul class="cl">
					<li>超级管理员</li>
					<li class="dropDown dropDown_hover"> <a href="#" class="dropDown_A">admin <i class="Hui-iconfont">&#xe6d5;</i></a>
						<ul class="dropDown-menu menu radius box-shadow">
							<li><button onclick="jump()">登录</button></li>
							<li><a href="#">切换账户</a></li>
							<li><a href="#">退出</a></li>
						</ul>
					</li>
					
				</ul>
			</nav>
		</div>
	</div>
</header>
<!--/_header 作为公共模版分离出去-->

<!--_menu 作为公共模版分离出去-->
<aside class="Hui-aside">
	
	<div class="menu_dropdown bk_2">
		<dl id="menu-article">
			<dt><i class="Hui-iconfont">&#xe616;</i> 查看所有信息<i class="Hui-iconfont menu_dropdown-arrow">&#xe6d5;</i></dt>
			<dd>
				<ul>
					<li><a href="resource.html" title="资源信息查看">查看所有资源信息</a></li>
				</ul>
				<ul>
					<li><a href="resource-c.html" title="资源信息查看">查看所有二手信息</a></li>
				</ul>
				<ul>
					<li><a href="resource-h.html" title="资源信息查看">查看所有求购信息</a></li>
				</ul>
				<ul>
					<li><a href="resource-u.html" title="资源信息查看">查看所有用户信息</a></li>
				</ul>
			</dd>
		</dl>
		<dl id="menu-picture">
			<dt><i class="Hui-iconfont">&#xe613;</i> 申请审批<i class="Hui-iconfont menu_dropdown-arrow">&#xe6d5;</i></dt>
			<dd>
				<ul>
					<li><a href="examine-r.html" title="资源申请">申请审批</a></li>
				</ul>
				<ul>
					<li><a href="examine-c.html" title="二手申请">二手申请审批</a></li>
				</ul>
				<ul>
					<li><a href="examine-h.html" title="求购申请">求购申请审批</a></li>
				</ul>
			</dd>
		</dl>


	</div>
</aside>
<div class="dislpayArrow hidden-xs"><a class="pngfix" href="javascript:void(0);" onClick="displaynavbar(this)"></a></div>
<!--/_menu 作为公共模版分离出去-->

<section class="Hui-article-box">
	<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 查看资源信息 <span class="c-gray en">&gt;</span> 资源列表<a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
	<div class="Hui-article">
		<article class="cl pd-20">
			<div class="text-c"> 
				<input type="text" class="input-text" style="width:250px" placeholder="输入资源id" id="myInput_searchrid_resource">
				
				<button type="text" class="btn btn-success radius" id="btn_searchrid_resource"><i class="Hui-iconfont">&#xe665;</i> 搜索资源id</button>

		
           
				<input type="text" class="input-text" style="width:250px" placeholder="输入类型" id="myInput_searchclassify_resource">
				
				<button type="text" class="btn btn-success radius" id="btn_searchclassify_resource"><i class="Hui-iconfont">&#xe665;</i> 搜索类型</button>
			</div>
			<div class="mt-20">
				<table class="table table-border table-bordered table-hover table-bg table-sort" id="resourceTable">
					<thead>
						<tr class="text-c">
							<th width="20">ID</th>
							<th width="40">名称</th>
							<th width="50">描述</th>
							<!-- <th width="50">图片</th> -->
							<th width="100">用户名</th>
							<th width="200">审批状态</th>
							<th width="20">收费类型</th>
							<th width="20">评分</th>
							<th width="90">开始时间</th>
							<th width="90">结束时间</th>
							<th width="50">类别</th>
							<th width="50">时段</th>
						</tr>
					</thead>
					<tbody>
						<tr class="text-c">
							
						</tr>
					</tbody>
				</table>
			</div>
		</article>
	</div>
</section>

<!--_footer 作为公共模版分离出去-->
<script type="text/javascript" src="lib/jquery/1.9.1/jquery.min.js"></script> 
<script type="text/javascript" src="lib/layer/2.4/layer.js"></script> 
 
<script type="text/javascript" src="lib/jquery.validation/1.14.0/jquery.validate.js"></script> 
<script type="text/javascript" src="lib/jquery.validation/1.14.0/validate-methods.js"></script> 
<script type="text/javascript" src="lib/jquery.validation/1.14.0/messages_zh.js"></script> 
<script type="text/javascript" src="static/h-ui/js/H-ui.js"></script> 
<script type="text/javascript" src="static/h-ui.admin/js/H-ui.admin.page.js"></script> 

<!--/_footer /作为公共模版分离出去-->

<!--请在下方写此页面业务相关的脚本-->

<script>
	function jump(){
		alert("你是超级管理员")
	}
</script>
<script type="text/javascript">

/*获取所有资源*/
$(function(){
    $.ajax({
        url:'http://123.57.243.139:8080/resource/getAll',
        type:'get',
        dataType:'json',
		async:false,
        success:function(result){
            for(var i=0;i<result.length;i++) 
            {
				var tr;   
				tr='<td>'+result[i].rid+'</td>'
					+'<td>'+result[i].rname+'</td>'
					+'<td>'+result[i].rdescription+'</td>'
					// +'<td>'+result[i].rpicture+'</td>'
					+'<td>'+result[i].uid+'</td>';
				if(result[i].status == 1)
				{
					tr +=  '<td>'+'未审批'+'</td>';
				}else if(result[i].status == 2)
				{
					tr +=  '<td>'+'审批通过'+'</td>';
				}else if(result[i].status == 3)
				{
					tr +=  '<td>'+'审批不通过'+'</td>';
				}
				
				if(result[i].type == 1)
				{
					tr +=  '<td>'+'付费资源'+'</td>';
				}else if(result[i].type == 0)
				{
					tr += '<td>'+'免费资源'+'</td>';
				}

				tr += '<td>'+result[i].tscore+'</td>'
				   +'<td>'+result[i].stime+'</td>'
					+'<td>'+result[i].etime+'</td>';
				if(result[i].classify == 1)
				{
					tr += '<td>'+'电子产品'+'</td>';
				}else if(result[i].classify == 2)
				{
					tr += '<td>'+'人力资源'+'</td>';
				}else if(result[i].classify == 3)
				{
					tr += '<td>'+'场馆'+'</td>';
				} else if(result[i].classify == 4)
				{
					tr += '<td>'+'交通工具'+'</td>';
				}else if(result[i].classify == 5)
				{
					tr += '<td>'+'书籍'+'</td>';
				} else if(result[i].classify == 6)
				{
					tr += '<td>'+'其他'+'</td>';
				} 
				tr += '<td>'+result[i].selected+'</td>';
				console.log(tr);
               $("#resourceTable").append('<tr>'+tr+'</tr>');
            }
        }
    });
})

/*根据rid查询*/
$(function(){
     $("#btn_searchrid_resource").click(function(){

        var input = document.getElementById("myInput_searchrid_resource").value;

		//$("#resourceTable").remove();
		var tb = document.getElementById('resourceTable');
    	 var rowNum=tb.rows.length;
     	for (i=1;i<rowNum;i++)
     	{
         tb.deleteRow(i);
         rowNum=rowNum-1;
         i=i-1;
    	 }

		$.ajax({
			url:'http://123.57.243.139:8080/resource/getById?rid='+input,
			type:'get',
			dataType:'json',
			success:function(result){
			//alert("搜索成功");
				var tr;
					tr='<td>'+result.rid+'</td>'
						+'<td>'+result.rname+'</td>'
						+'<td>'+result.rdescription+'</td>'
						// +'<td>'+result.rpicture+'</td>'
						+'<td>'+result.uid+'</td>';
					if(result.status == 1)
					{
						tr +=  '<td>'+'未审批'+'</td>';
					}else if(result.status == 2)
					{
						tr +=  '<td>'+'审批通过'+'</td>';
					}else if(result.status == 3)
					{
						tr +=  '<td>'+'审批不通过'+'</td>';
					}
					if(result.type == 1)
					{
						tr +=  '<td>'+'付费资源'+'</td>';
					}else if(result.type == 0)
					{
						tr += '<td>'+'免费资源'+'</td>';
					}

					tr += '<td>'+result.tscore+'</td>'
				   		+'<td>'+result.stime+'</td>'
						+'<td>'+result.etime+'</td>';
					if(result.classify == 1)
					{
						tr += '<td>'+'电子产品'+'</td>';
					}else if(result.classify == 2)
					{
						tr += '<td>'+'人力资源'+'</td>';
					}else if(result.classify == 3)
					{
						tr += '<td>'+'场馆'+'</td>';
					} else if(result.classify == 4)
					{
						tr += '<td>'+'交通工具'+'</td>';
					}else if(result.classify == 5)
					{
						tr += '<td>'+'书籍'+'</td>';
					} else if(result.classify == 6)
					{
						tr += '<td>'+'其他'+'</td>';
					} 
					tr += '<td>'+result.selected+'</td>';

					console.log(tr);

					
					
               	$("#resourceTable").append('<tr>'+tr+'</tr>');
			}
		
		});
	})
})


/*根据classify查询*/
$(function(){
     $("#btn_searchclassify_resource").click(function(){

        var input = document.getElementById("myInput_searchclassify_resource").value;
		
		var input1;
		if(input == "电子产品")
		{
			input1 = 1;
		}else if(input == "人力资源")
		{
			input1 = 2;
		}else if(input == "场馆")
		{
			input1 = 3;
		}else if(input == "交通工具")
		{
			input1 = 4;
		}else if(input == "书籍")
		{
			input1 = 5;
		}else if(input == "其他")
		{
			input1 = 6;
		}else{
			alert("资源不存在");
		}
		console.log(input1);

		var tb = document.getElementById('resourceTable');
    	 var rowNum=tb.rows.length;
     	for (i=1;i<rowNum;i++)
     	{
         tb.deleteRow(i);
         rowNum=rowNum-1;
         i=i-1;
    	 }

		$.ajax({
			url:'http://123.57.243.139:8080/resource/getByClassify?classify='+input1,
			type:'get',
			dataType:'json',
			async: 'false',
			success:function(result){
            for(var i=0;i<result.length;i++) 
            {
				var tr;   
				tr='<td>'+result[i].rid+'</td>'
					+'<td>'+result[i].rname+'</td>'
					+'<td>'+result[i].rdescription+'</td>'
					// +'<td>'+result[i].rpicture+'</td>'
					+'<td>'+result[i].uid+'</td>';
				if(result[i].status == 1)
				{
					tr +=  '<td>'+'未审批'+'</td>';
				}else if(result[i].status == 2)
				{
					tr +=  '<td>'+'审批通过'+'</td>';
				}else if(result[i].status == 3)
				{
					tr +=  '<td>'+'审批不通过'+'</td>';
				}
				
				if(result[i].type == 1)
				{
					tr +=  '<td>'+'付费资源'+'</td>';
				}else if(result[i].type == 0)
				{
					tr += '<td>'+'免费资源'+'</td>';
				}

				tr += '<td>'+result[i].tscore+'</td>'
				   +'<td>'+result[i].stime+'</td>'
					+'<td>'+result[i].etime+'</td>';
				if(result[i].classify == 1)
				{
					tr += '<td>'+'电子产品'+'</td>';
				}else if(result[i].classify == 2)
				{
					tr += '<td>'+'人力资源'+'</td>';
				}else if(result[i].classify == 3)
				{
					tr += '<td>'+'场馆'+'</td>';
				} else if(result[i].classify == 4)
				{
					tr += '<td>'+'交通工具'+'</td>';
				}else if(result[i].classify == 5)
				{
					tr += '<td>'+'书籍'+'</td>';
				} else if(result[i].classify == 6)
				{
					tr += '<td>'+'其他'+'</td>';
				} 
				tr += '<td>'+result[i].selected+'</td>';
				console.log(tr);
               $("#resourceTable").append('<tr>'+tr+'</tr>');
            	}
		
			}
		});
	 })
})
</script>
<!--/请在上方写此页面业务相关的脚本-->
</body>
</html>